package com.example.light.web.system.controller;

import com.example.light.web.system.entity.Role;
import com.example.light.web.system.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RoleController {

    @Autowired
    private RoleService roleService;
    
    /**
     *
     * 功能描述: 角色界面展示
     *
     * @param: 
     * @return: 
     * @auther: 
     * @date:  
     */
    @RequestMapping("/role.shtml")
    public String QueryAll(Model model){
        String path=roleService.QueryAll(model);
        return path;
    }


    /**
     *
     * 功能描述: 角色添加界面导入
     *
     * @param:
     * @return:
     * @auther:
     * @date:
     */
    @RequestMapping("/roleaddView.shtml")
    public String roleAddView(Model model,Integer roleId)throws Exception{

        String path=roleService.roleAddView(model,roleId);
        return path;
    }

    /**
     *
     * 功能描述: 角色添加
     *
     * @param:
     * @return:
     * @auther:
     * @date:
     */
    @RequestMapping("/roleadd.shtml")
    @ResponseBody
    public String roleAdd(Model model,Role role)throws Exception{
        String path=roleService.roleAdd(model,role);
        return path;

    }

    /**
     *
     * 功能描述: 修改界面导入
     *
     * @param:
     * @return:
     * @auther:
     * @date:
     */
    @RequestMapping("/roleUpdateView.shtml")
    public String roleUpdateView(Model model,Role role)throws Exception{
        String path=roleService.roleUpdateView(model,role);
        return path;
    }

    /**
     *
     * 功能描述: 部门修改
     *
     * @param:
     * @return:
     * @auther:
     * @date:
     */
    @RequestMapping("/roleUpdate.shtml")
    @ResponseBody
    public String roleUpdate(Model model,Role role)throws Exception{
        String path=roleService.roleUpdate(model,role);
        return path;

    }


    /**
     *
     * 功能描述: 部门删除
     *
     * @param:
     * @return:
     * @auther:
     * @date:
     */
    @RequestMapping("/roleDelet.shtml")
    public String deptDelet(Model model,@RequestParam(value = "roleIds[]")Integer[] ids)throws Exception{

        String path= roleService.roleDeletM(model,ids);;
        return path;

    }
}
